﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RedisDemo.Redis.Base;
using RedisDemo.Service.IServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace RedisDemo.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class PubSubController : ControllerBase
    {
        private readonly IUserService _userService;
        private readonly RedisConfig _redis;

        public PubSubController(IUserService userService, RedisConfig redis)
        {
            _userService = userService;
            _redis = redis;
        }

        [HttpGet, Route("Pub")]
        public async Task Pub()
        {
            await _userService.Pub();
        }
        [HttpGet, Route("Sub")]
        public async Task Sub()
        {
            await _userService.Sub();
        }

        [HttpPost, Route("UnsubscribeAsync")]
        public async Task UnsubscribeAsync()
        {
            await _userService.UnsubscribeAsync();
        }

        [HttpPost, Route("UnsubscribeAllAsync")]
        public async Task UnsubscribeAllAsync()
        {
            await _userService.UnsubscribeAllAsync();
        }
    }
}
